/* $Id: iter.h 15 2006-12-15 23:14:45Z judas $ */

#ifndef NIH_ITER_H
#define NIH_ITER_H 1

#include <nih/cdefs.h>

BEGIN_C_DECLS

/* XXX Do we need this file? */

typedef void *nih_iter_fnc(void *data);

struct nih_iter {
	nih_iter_fnc *begin;
	nih_iter_fnc *next;
	nih_iter_fnc *end;
	void *udata;
};

extern struct nih_iter *nih_iter_create(nih_iter_fnc *begin_fnc,
                                        nih_iter_fnc *next_fnc,
                                        nih_iter_fnc *end_fnc);

extern void *nih_iter_begin(struct nih_iter *iter, void *data);

extern void *nih_iter_next(struct nih_iter *iter, void *data);

extern void *nih_iter_end(struct nih_iter *iter, void *data);

extern int nih_iter_walk(struct nih_iter *iter, void *data,
                         nih_iter_fnc *walk_fnc);

extern int nih_iter_destroy(struct nih_iter *iter);

END_C_DECLS

#endif /* NIH_ITER_H */

